import { service,post, put } from '@/utils/request';

export function getList(code){
    return new Promise((resolve, reject) => {
        service.get('dictionary/'+code)
            .then(res => {
                resolve(res.data)
            })
            .catch(err => {
                reject(err)
            })
    })
}

export function insertItem(data){
    return post('dictionary/item',data);
}

export function updateItem(data){
    return put('dictionary/item',data)
}

export function deleteItem(id){
    return new Promise((resolve, reject) => {
        service.delete('dictionary/item/'+id)
            .then(res => {
                resolve(res.data)
            })
            .catch(err => {
                reject(err)
            })
    })
}